package com.example.houqin_oa.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.comment_oa.pojos.PersonalEffects;
import com.example.comment_oa.pojos.RepairRecord;
import com.example.houqin_oa.mapper.RepairRecordMapper;
import com.example.houqin_oa.mapper.ReplaceRecordMapper;
import com.example.houqin_oa.service.PersonalEffectsService;
import com.example.houqin_oa.mapper.PersonalEffectsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author liang
* @description 针对表【personal_effects】的数据库操作Service实现
* @createDate 2022-10-20 20:36:24
*/
@Service
public class PersonalEffectsServiceImpl extends ServiceImpl<PersonalEffectsMapper, PersonalEffects>
    implements PersonalEffectsService{

    @Autowired
    PersonalEffectsMapper personalEffectsMapper;

    @Autowired
    ReplaceRecordMapper replaceRecordMapper;

    @Autowired
    RepairRecordMapper repairRecordMapper;

    @Override
    public List<PersonalEffects> EffectsAll(PersonalEffects personalEffects) {
        return personalEffectsMapper.EffectsAll(personalEffects);
    }

    @Override
    public boolean UpkeepDraw(PersonalEffects personalEffects) {
        boolean UpkeepRe = false;
        boolean UpkeepDr = false;
        personalEffects.setPersonalState("10");
        UpkeepRe = repairRecordMapper.UpkeepReplace(personalEffects);
        personalEffects.setPersonalState("0");
        UpkeepDr = personalEffectsMapper.UpkeepDraw(personalEffects);
        if (UpkeepRe == false || UpkeepDr == false){
            return false;
        }else {
            return true;
        }

    }
}




